package com.leejxx.article.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.leejxx.article.dao.AuthorDao;
import com.leejxx.article.service.AuthorService;
import com.leejxx.model.article.pojos.ApAuthor;
import com.leejxx.model.common.dto.ResponseResult;
import com.leejxx.model.common.enums.AppHttpCodeEnum;
import org.springframework.stereotype.Service;

/**
 * @Author LeeJx
 * @ClassName AuthorServiceImpl
 * @Description TODO
 * @date 2021/2/20 11:17
 * @Version 1.0
 */
@Service
public class AuthorServiceImpl extends ServiceImpl<AuthorDao, ApAuthor> implements AuthorService {
    @Override
    public ApAuthor findAuthorById(Integer userId) {
        return getById(userId);
    }

    @Override
    public ResponseResult saveAuthor(ApAuthor apAuthor) {
        if (null == apAuthor) {
            return ResponseResult.errorResult(AppHttpCodeEnum.PARAM_INVALID);
        }

        save(apAuthor);
        return ResponseResult.okResult(AppHttpCodeEnum.SUCCESS);
    }
}
